mod cast;
mod num;

pub use cast::{cast, NumCast};
pub use num::Integer;

pub fn add<T: Integer>(lhs: T, rhs: T) -> T {
  lhs + rhs
}

pub fn increment<T: Integer + NumCast>(lhs: T) -> T {
  add(lhs, cast(1).unwrap())
}

#[cfg(test)]
mod test {
  use crate::{add, increment};

  #[test]
  fn test_add_one() {
    assert_eq!(increment(10), 11);
  }

  #[test]
  fn test_add() {
    assert_eq!(add(10, 11), 21);
  }
}
